<template>
  <a-card :bordered='false' class='card-area'>
    <!-- 查询区域 11111-->
    <div class='table-page-search-wrapper'>
      <a-form layout='inline' :label-col='labelCol' @keyup.enter.native='searchQuery'>
        <a-row :gutter='24'>
          <a-col :md='6' :sm='6'>
            <a-form-item label='活动主题'>
              <a-input placeholder='请输入活动主题' v-model='queryParam.topic'></a-input>
            </a-form-item>
          </a-col>
          <a-col :md='6' :sm='6'>
            <a-form-item label='活动组织者'>
              <a-input placeholder='请输入活动组织者' v-model='queryParam.organizer'></a-input>
            </a-form-item>
          </a-col>
          <a-col :md='6' :sm='6'>
            <a-form-item label='活动日期' prop='activityDate'>
              <a-date-picker format='YYYY-MM-DD' v-model='queryParam.activityTime'
                             placeholder='请选择活动日期' style='width: 200px' valueFormat='YYYY-MM-DD' />
            </a-form-item>
          </a-col>
          <a-col :md='6' :sm='6'>
            <a-form-item label='活动属性'>
              <a-select placeholder="请选择活动属性" v-model="queryParam.activityAttr">
                <a-select-option value="">请选择</a-select-option>
                <a-select-option value="0">活动</a-select-option>
                <a-select-option value="1">课程</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <span style='float: left;overflow: hidden;' class='table-page-search-submitButtons'>
           <a-col :md='6' :sm='24'>
               <a-button type='primary' @click='searchQuery' icon='search'>查询</a-button>
               <a-button type='primary' @click='searchReset' icon='reload' style='margin-left: 8px'>重置</a-button>
           </a-col>
        </span>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class='table-operator'>
      <a-button @click='handleAdd' type='primary' icon='plus'>新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>


      <a-table
        ref='table'
        size='middle'
        bordered
        rowKey='id'
        :columns='columns'
        :dataSource='dataSource'
        :pagination='ipagination'
        :loading='loading'
        @change='handleTableChange'>

        <span slot='action' slot-scope='text, record'>
          <a @click='handleEdit(record)'>查看参与者</a>
<!--          <a-divider type='vertical' />-->
<!--          <a @click='handleEdit(record)'>长者身体记录</a>-->
<!--          <a-divider type='vertical' />-->
<!--          <a @click='handleImg(record)'>上传活动照片</a>-->
          <a-divider type='vertical' />
          <a-dropdown>
            <a class='ant-dropdown-link'>更多 <a-icon type='down' /></a>
                <a-menu slot='overlay'>
                      <a-menu-item>
                        <a-popconfirm title='确定删除吗?' @confirm='() => handleDelete(record.id)'>
                          <a>删除</a>
                        </a-popconfirm>
                      </a-menu-item>
                </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <HHisActivity-modal ref='modalForm' @ok='modalFormOk'></HHisActivity-modal>
    <HHisActivityImg-modal ref='modalFormImg' @ok='modalFormOk'></HHisActivityImg-modal>

  </a-card>
</template>
<script>
import '@assets/less/TableExpand.less'
import HHisActivityModal from './modules/HHisActivityDetailModal'
import HHisActivityImgModal from './modules/HHisActivityImgModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { putAction, getAction, postAction } from '@api/manage'
import { frozenBatch } from '@api/api'

export default {
  name: 'h_his_activityList',
  mixins: [JeecgListMixin],
  components: {
    HHisActivityModal,
    HHisActivityImgModal
  },
  data() {
    return {
      description: '活动管理管理页面',
      labelCol: { style: { width: '80px' } },
      // 表头
      columns: [
        {
          title: '活动主题',
          align: 'center',
          dataIndex: 'topic'
        },
        {
          title: '活动属性',
          align: 'center',
          dataIndex: 'activityAttr',
          customRender: function(t, r, index) {
            return t=='0'?"活动":"课程";
          }
        },
        {
          title: '活动名称',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '活动地点',
          align: 'center',
          dataIndex: 'place'
        },
        {
          title: '活动组织者',
          align: 'center',
          dataIndex: 'organizer'
        },
        {
          title: '联系电话',
          align: 'center',
          dataIndex: 'phone'
        },
        {
          title: '活动日期',
          align: 'center',
          dataIndex: 'activityDate'
        },
        {
          title: '创建人员 ',
          align: 'center',
          dataIndex: 'createUser'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/his/activity/list',
        delete: '/his/activity'
      }
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    handleAdd: function() {
      this.$router.push({ path: '/activitys/create' })
    },
    handleImg: function (record) {
      this.$refs.modalFormImg.edit(record);
      this.$refs.modalFormImg.title = "编辑";
      this.$refs.modalFormImg.disableSubmit = false;
    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>